package com.dongdongshop.pojo.data;

import java.io.Serializable;
import java.util.List;

/**
 * 分页工具类
 * @param <T>
 */
public class PageBean<T> implements Serializable {
    private Integer pageNumber; //当前页数
    private Integer pageSize; //每页条数
    private Integer starIndex; //开始位置
    private Integer totalCount; //查询出来的数据总条数
    private Integer totalPage; //总页数
    private List<T> result; //查询出来的数据结果集
    public Integer getPageNumber() {
        return pageNumber;
    }
    public void setPageNumber(Integer pageNumber) {
        this.pageNumber = pageNumber;
    }
    public Integer getPageSize() {
        return pageSize;
    }
    public void setPageSize(Integer pageSize) {
        this.pageSize = pageSize;
    }
    public Integer getStarIndex() {
        //(当前页数 -1 ) * 每页条数
        return (pageNumber - 1) * pageSize;
    }
    public void setStarIndex(Integer starIndex) {
        this.starIndex = starIndex;
    }
    public Integer getTotalCount() {
        return totalCount;
    }
    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }
    public Integer getTotalPage() {
        //totalPage =    totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1
        return totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1;
    }
    public void setTotalPage(Integer totalPage) {
        this.totalPage = totalPage;
    }
    public List<T> getResult() {
        return result;
    }
    public void setResult(List<T> result) {
        this.result = result;
    }


}
